package com.yunsom.testdemo.design.builder;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Xbao
 * @version 1.0
 * @description
 * @date 2021/3/30 19:01
 */
public class HotPot {

  public List<Material> materialList = new ArrayList<>();

  public void addMaterial(Material material){
    this.materialList.add(material);
  }

  public Double getCost(){
    return materialList.stream().mapToDouble(Material::price).sum();
  }

  public void showMaterials(){
    for (Material material : materialList){
      System.out.println("name:"+material.name());
      System.out.println("vessel:"+material.vessel().packing());
      System.out.println("price:"+material.price());
    }
  }
}
